package tv.danmaku.ijk.media.player.misc;

import android.annotation.TargetApi;
import android.media.MediaFormat;
import android.media.MediaPlayer.TrackInfo;
import android.media.MediaPlayer;
import android.os.Build;

public class AndroidTrackInfo implements ITrackInfo {
    private final MediaPlayer.TrackInfo mTrackInfo;

    private AndroidTrackInfo(MediaPlayer.TrackInfo arg1) {

        this.mTrackInfo = arg1;
    }

    public static AndroidTrackInfo[] fromMediaPlayer(MediaPlayer arg2) {
        AndroidTrackInfo[] v0 = Build.VERSION.SDK_INT >= 16 ? AndroidTrackInfo.fromTrackInfo(arg2.getTrackInfo()) : null;
        return v0;
    }

    private static AndroidTrackInfo[] fromTrackInfo(MediaPlayer.TrackInfo[] arg4) {
        AndroidTrackInfo[] v0;
        if(arg4 == null) {
            v0 = null;
        }
        else {
            AndroidTrackInfo[] v1 = new AndroidTrackInfo[arg4.length];
            int v0_1;
            for(v0_1 = 0; v0_1 < arg4.length; ++v0_1) {
                v1[v0_1] = new AndroidTrackInfo(arg4[v0_1]);
            }

            v0 = v1;
        }

        return v0;
    }

    @TargetApi(value=19) public IMediaFormat getFormat() {
        AndroidMediaFormat v0_1 = null;
        IMediaFormat v0 = null;
        if(this.mTrackInfo != null && Build.VERSION.SDK_INT >= 19) {
            MediaFormat v1 = this.mTrackInfo.getFormat();
            if(v1 != null) {
                v0_1 = new AndroidMediaFormat(v1);
            }
        }

        return ((IMediaFormat)v0_1);
    }

    @TargetApi(value=16) public String getInfoInline() {
        String v0 = this.mTrackInfo != null ? this.mTrackInfo.toString() : "null";
        return v0;
    }

    @TargetApi(value=16) public String getLanguage() {
        String v0 = this.mTrackInfo == null ? "und" : this.mTrackInfo.getLanguage();
        return v0;
    }

    @TargetApi(value=16) public int getTrackType() {
        int v0 = this.mTrackInfo == null ? 0 : this.mTrackInfo.getTrackType();
        return v0;
    }

    @TargetApi(value=16) public String toString() {
        StringBuilder v0 = new StringBuilder(128);
        v0.append(this.getClass().getSimpleName());
        v0.append('{');
        if(this.mTrackInfo != null) {
            v0.append(this.mTrackInfo.toString());
        }
        else {
            v0.append("null");
        }

        v0.append('}');
        return v0.toString();
    }
}

